﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Net;
using System.IO;
using System.Web.Script.Serialization;

using PiscoSourRESTTest;
using PiscoSourDominio;

namespace PiscoSourRESTTest
{
    /// <summary>
    /// Summary description for UnitTest1
    /// </summary>
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            HttpWebRequest req2 = (HttpWebRequest)WebRequest
                    .Create("http://localhost:49781/Services/Reservas.svc/Reservas");
            req2.Method = "GET";
            HttpWebResponse res2 = (HttpWebResponse)req2.GetResponse();
            StreamReader reader2 = new StreamReader(res2.GetResponseStream());
            string ReservaJson2 = reader2.ReadToEnd();
            JavaScriptSerializer js2 = new JavaScriptSerializer();
            List<Reserva> lista = js2.Deserialize<List<Reserva>>(ReservaJson2);

            Assert.AreEqual(1, lista[0].IntReserva);
        }
    }
}
